home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
726-750
/
732
/
pstools
/
resetadobe
/
resetadobe.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-18
|
2KB
|
94 lines
/*
Name: resetadobe.c
Processor: Amiga 68000
Compiler directive: lc -L xxx.c
Creation Date: 11 May 92
Version: 1.00
Author: I Parker & D Spencer
Description Changes character spacing in afm files after creation by
pfm2afm
*/
#include <stdio.h>
#include <string.h>
#define outfile "corrected.afm" /* output file name preset */
FILE *ifp, *ofp, *fopen();
main (argc, argv)
int argc;
char *argv[];
{
char inline[100]; /* input line buffer */
int index;
if(argc == 1)
{
printf("\033[33mresetadobe by I Parker & D Spencer V1.00\n");
/* \033[33m = prt blue */
printf("Usage resetadobe xxx.afm increase\033[31m\n");
/* \033[31m = reset */
}
if(argc == 2)
printf("\033[4msize increase missing\033[0m\n");
/* \033[4m Underline */
if(argc >= 3)
{
if((ifp = fopen(argv[1],"r"))==NULL) {
fprintf(stderr, "Error : Cannot open input file %s\n", strupr(argv[1]));
exit(-1);
}
if((ofp = fopen(outfile, "wb"))==NULL) {
fprintf(stderr, "Error : Unable to open output file %s\n",outfile);
exit(1);
}
printf("Converting adobe font metrics spacing by %s\n",argv[2]);
while(fgets(inline,100,ifp)!=NULL)
{
char outline[100];
int op;
int total,modification;
modification=atoi(argv[2]);
index = 0;
op = 0;
for (index=0; inline[index] /*!='\n'*/ && inline[index]!='W';index++)
outline[op++]=inline[index];
if ((outline[op++]=inline[index++])=='W')
{
if ((outline[op++]=inline[index++])=='X')
{
total=0;
while (inline[index]<'0' || inline[index]>'9')
outline[op++]=inline[index++];
/* now op corresponds to the first digit in inline[]. */
while (inline[index]>='0' && inline[index]<='9')
total = total*10+inline[index++]-'0';
total = total+modification; /* comment! */
op += sprintf(outline+op,"%d",total);
}
while (outline[op++]=inline[index++]);
}
index=0;
while(outline[index] != '\0')
putc((outline[index++]),ofp);
} /* end of while --fgets-- */
}
fclose(ifp);
fclose(ofp);
}